package conf

import (
	"fmt"
)

var (
	PubConfServerList = make(map[int]ConfigServer) //服务器列表
	PubConfServer     *ConfigServer                //服务器列表
)

func InitExtPublic(ServerId int) bool {

	ConfigLock.Lock()
	defer ConfigLock.Unlock()

	//服务器列表
	if err := ReadJson("ConfigServer", &PubConfServerList); err != nil {
		fmt.Println("PubConfServerList err", err)
		return false
	}
	//获取服务器配置
	configServer, ok := PubConfServerList[ServerId]
	if !ok {
		fmt.Println("找不到服务器配置 ID:", ServerId)
		return false
	}
	PubConfServer = &configServer

	return true
}
